#ifndef LOGINT_H
#define LOGINT_H

/*!
Logging interface of the framework, will keep track of all information needed through a DB, supports GUI/CMD and differentiates between Warning, prompt, debug, error
*/

/**
* \class LogInt
* \brief Logging interface of the framework, will keep track of all information needed through a DB, supports GUI/CMD and differentiates between 
* Warning, prompt, debug, error
* \author Elie M. Shaccour (elie.shaccour@gmail.com)
* 
*/

class LogInt
{
public:
/*! initializing the interface, data needed: 
1)type of logging, 'E' for error 'W' for warning, 'D' Debug and 'P' for prompt
2)Message to be displayed
3)Message to be logged, should be "" if msg to be logged is similar to Message to be displayed
4)If the interface is GUI or CMD. By default it is CMD, should be set to true if a GUI interface is needed
*/
        /**     \brief Constructor of the class
	*	\param Msg_Type Type of msg 'E' for error 'W' for warning, 'D' Debug and 'P' for prompt
        *       \param Disp_Msg Msg to be shown on the screen in CMD mode or using a pop-up message in GUI
	*	\param Log_Msg Msg to be logged in db, iff it is different than the displayed msg. If similar then keep empty
	*	\param Is_GUI bool to know if this is logging for GUI or CMD, by default set to false i.e. CMD mode
        */
	LogInt(char Msg_Type, std::string Disp_Msg, std::string Log_Msg="", bool Is_GUI=false);//Type=={E,W,D,P}
	~LogInt();

        /**     \brief Calls the display function, will do its job depending on whether we are GUI or CMD and taking the type of msg into consideration
        */
	void Display();//D

	/** \brief For GUI mode sets the OK button to visible 
	*/
	void SetOKButtonVisible();//D

	/** \brief For GUI mode sets the Cancel button to visible 
	*/
	void SetCancelButtonVisible();//D

private:
///Type of msg 'E' for error 'W' for warning, 'D' Debug and 'P' for prompt
	char MsgType;
///Message to be logged to DB
	std::string LogMsg;
///Current time and date
	std::string TimeDate;
///Message to be displayed on the screen form CMD or as a pop-up message for GUI
	std::string DispMsg;
	bool Displayed;//Will check if the log was performed, thus reporting unnecessary manipulation of the class. e.g. If I execute and later decide to add OK button wrng
///For gui use only, add OK button to the pop-up window
	bool OKButton;
///FOr gui use only, add Cancel button to the pop-up window
	bool CancelButton;
///boolean to track if logint used is for GUI or CMD
	bool IsGUI;
	
	/**     \brief Error CMD function. Will display and log error 
        */
	void ErrorCmd();

	/**     \brief Error GUI function. Will pop-up display and log error
        */
	void ErrorGui();

	/**     \brief Warning CMD function. Will display and log warning
        */
	void WarningCmd();

	/**     \brief Warning GUI function. Will pop-up display and log warning
        */
	void WarningGui();

	/**     \brief Debug interface. Only CMD allowed
        */
	void Debug();
	
	/**     \brief Prompt CMD function. Will display and log prompts
        */
	void PromptCmd();

	/**     \brief Prompt GUI function. Will pop-up display and log prompts
        */
	void PromptGui();
	
	/**     \brief Will log data to the DB with the appropriate message not necessarily the displayed one
        */
	void LogToDB();
};


#endif
